home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Gamer (Italian) 36
/
PC Gamer IT CD 36 2-2.iso
/
VIGDEMO
/
data1.cab
/
Assets
/
scripts
/
sensor.e
< prev
next >
Wrap
Text File
|
1998-09-21
|
4KB
|
646 lines
int Initialize(string type) {
global real gInRadius;
global real gOutRadius;
global int gNetwork = 0;
global string gMessage = "dummy";
global int gLineOfSight = 0;
global int gState = 0;
global int gOneTime = 0;
global int gTurnOff = 0;
global int gStartSound = 45;
global int gProgressSound = 36;
global int gEndSound = 45;
global int gVoiceOver = -1;
global real gStartDelay = 0.0;
global int gMsgSnd = -1;
gInRadius = 50.0;
gOutRadius = 90.0;
Reset("dummy");
}
int Reset(string dummy)
{
SetCollidableProperties(thisObject,1,0);
SetStyle(thisObject,5);
gTurnOff = 0;
wakeupTime = -1.0;
gState = 0;
IgnoreCollision(thisObject);
}
int startsound(string soundname)
{
gStartSound = GetSoundIndex(soundname);
}
int say(string soundname)
{
gVoiceOver = GetBrainVOSoundIndex(soundname);
}
int endsound(string soundname)
{
gEndSound = GetSoundIndex(soundname);
}
int progresssound(string soundname)
{
gProgressSound = GetSoundIndex(soundname);
}
int msgsnd(string soundname)
{
gMsgSnd = GetSoundIndex(soundname);
}
int startdelay(string str)
{
gStartDelay = Str2Real(str);
}
int onetime(string dummy)
{
gOneTime = 1;
}
int inradius(string str)
{
gInRadius = Str2Real(str);
}
int network(string str)
{
gNetwork = Str2Int(str);
}
int outradius(string str)
{
gOutRadius = Str2Real(str);
}
int lineofsight(string dummy)
{
int value;
value = str2int(dummy);
gLineOfSight = value;
}
int Collidants(string dummy) {
int result;
map::iterator ix;
map::iterator iy;
map objInList;
real time;
result = 0;
time = GetTime(thisObject);
if (gTurnOff == 0)
{
if (IsAuthoritative(thisObject) != 1)
return result;
if (gState == 0)
{
objInList = Collisions(thisObject,1,1,0);
ix = begin(objInList);
iy = end(objInList);
if (ix != iy)
{
if (gOneTime == 1)
{
gTurnOff = 1;
}
PlayVoiceOver(gVoiceOver);
SendEnglishMessage(thisObject);
wakeupTime = time + gStartDelay;
gState = 1;
}
}
}
IgnoreCollision(thisObject);
}
int TimedEvent(int input)
{
if (gState == 1)
{
PlaySound(thisObject,gStartSound);
PlaySound(thisObject,gMsgSnd);
SendMessage(thisObject,gOutRadius,gNetwork);
wakeupTime = -1.0;
gState = 0;
}
return 0;
}
int start(string dummy)
{
real time;
time = GetTime(thisObject);
wakeupTime = time + gStartDelay;
gState = 1;
return 0;
}